home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / PInterfaces / WorldScript.p < prev   
Text File  |  1996-05-01  |  9KB  |  323 lines

  1. {
  2.      File:        WorldScript.p
  3.  
  4.      Contains:    WorldScript I Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT WorldScript;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __WORLDSCRIPT__}
  28. {$SETC __WORLDSCRIPT__ := 1}
  29.  
  30. {$I+}
  31. {$SETC WorldScriptIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __TRAPS__}
  38. {$I Traps.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __QUICKDRAWTEXT__}
  41. {$I QuickdrawText.p}
  42. {$ENDC}
  43.  
  44. {$PUSH}
  45. {$ALIGN MAC68K}
  46. {$LibExport+}
  47.  
  48.  
  49. TYPE
  50.     WSIOffset                            = UInt16;
  51.     WSIByteCount                        = UInt8;
  52.     WSIByteIndex                        = UInt8;
  53. {  offset from start of sub-table to row in state table  }
  54.     WSIStateOffset                        = UInt16;
  55.     WSITableOffset                        = UInt32;
  56.     WSISubtableOffset                    = UInt16;
  57.     WSIGlyphcode                        = UInt16;
  58.     WSITableIdentifiers                    = UInt32;
  59.  
  60. CONST
  61.     kScriptSettingsTag            = 'info';
  62.     kMetamorphosisTag            = 'mort';
  63.     kGlyphExpansionTag            = 'g2g#';
  64.     kPropertiesTag                = 'prop';
  65.     kJustificationTag            = 'kash';
  66.     kCharToGlyphTag                = 'cmap';
  67.     kGlyphToCharTag                = 'pamc';
  68.     kFindScriptRunTag            = 'fstb';
  69.  
  70. { ***             L O O K U P    T A B L E    T Y P E S        *** }
  71.     WSILookupSimpleArray        = 0;                            {  a simple array indexed by glyph code  }
  72.     WSILookupSegmentSingle        = 2;                            {  segment mapping to single value  }
  73.     WSILookupSegmentArray        = 4;                            {  segment mapping to lookup array  }
  74.     WSILookupSingleTable        = 6;                            {  sorted list of glyph, value pairs  }
  75.     WSILookupTrimmedArray        = 8;                            {  a simple trimmed array indexed by glyph code  }
  76.  
  77.  
  78. TYPE
  79.     WSILookupTableFormat                = INTEGER;
  80.     WSILookupValue                        = INTEGER;
  81. {  An offset from the beginning of the lookup table  }
  82.     WSILookupOffset                        = INTEGER;
  83. {     FORMAT SPECIFIC DEFINITIONS  }
  84. {
  85.         lookupSimpleArray:
  86.         
  87.         This is a simple array which maps all glyphs in the font
  88.         to lookup values.
  89. }
  90.     WSILookupArrayHeaderPtr = ^WSILookupArrayHeader;
  91.     WSILookupArrayHeader = RECORD
  92.         lookupValues:            ARRAY [0..0] OF WSILookupValue;            {  The array of values indexed by glyph code  }
  93.     END;
  94.  
  95. {
  96.         lookupTrimmedArray:
  97.         
  98.         This is a single trimmed array which maps a single range
  99.         of glyhs in the font to lookup values.
  100. }
  101.     WSILookupTrimmedArrayHeaderPtr = ^WSILookupTrimmedArrayHeader;
  102.     WSILookupTrimmedArrayHeader = RECORD
  103.         firstGlyph:                WSIGlyphcode;
  104.         limitGlyph:                WSIGlyphcode;
  105.         valueArray:                ARRAY [0..0] OF WSILookupValue;
  106.     END;
  107.  
  108. {  The format specific part of the subtable header  }
  109.     WSILookupFormatSpecificHeaderPtr = ^WSILookupFormatSpecificHeader;
  110.     WSILookupFormatSpecificHeader = RECORD
  111.         CASE INTEGER OF
  112.         0: (
  113.             lookupArray:        WSILookupArrayHeader;
  114.             );
  115.         1: (
  116.             trimmedArray:        WSILookupTrimmedArrayHeader;
  117.             );
  118.     END;
  119.  
  120. {  The overall subtable header  }
  121.     WSILookupTableHeaderPtr = ^WSILookupTableHeader;
  122.     WSILookupTableHeader = RECORD
  123.         format:                    WSILookupTableFormat;                    {  table format  }
  124.         fsHeader:                WSILookupFormatSpecificHeader;            {  format specific header  }
  125.     END;
  126.  
  127. { ***        G L Y P H    E X P A N S I O N    *** }
  128.  
  129. CONST
  130.                                                                 {  fixed 1.0  }
  131.     kCurrentGlyphExpansionVersion = $00010000;
  132.  
  133.  
  134. TYPE
  135.     GlyphExpansionFormats                = INTEGER;
  136.  
  137. CONST
  138.     GlyphExpansionLookupFormat    = 1;
  139.     GlyphExpansionContextualFormat = 2;
  140.  
  141.  
  142. TYPE
  143.     ExpandedGlyphClusterPtr = ^ExpandedGlyphCluster;
  144.     ExpandedGlyphCluster = PACKED RECORD
  145.         numGlyphs:                WSIByteCount;
  146.         bestGlyph:                WSIByteIndex;
  147.         glyphs:                    ARRAY [0..0] OF WSIGlyphcode;
  148.     END;
  149.  
  150.     ExpandedGlyphOffsetPtr = ^ExpandedGlyphOffset;
  151.     ExpandedGlyphOffset = RECORD
  152.         glyph:                    WSIGlyphcode;
  153.         offset:                    WSIOffset;                                {  offset to ExpandedGlyphCluster  }
  154.     END;
  155.  
  156.     GlyphExpansionStateTablePtr = ^GlyphExpansionStateTable;
  157.     GlyphExpansionStateTable = RECORD
  158.         stateTableOffset:        WSISubtableOffset;
  159.         classTableOffset:        WSISubtableOffset;
  160.         actionTableOffset:        WSISubtableOffset;                        {  state, class and actions tables follow here...  }
  161.     END;
  162.  
  163.     GlyphExpansionTablePtr = ^GlyphExpansionTable;
  164.     GlyphExpansionTable = RECORD
  165.         version:                Fixed;
  166.         format:                    INTEGER;
  167.         expansionNumer:            INTEGER;
  168.         expansionDenom:            INTEGER;                                {  num/denom ratio for expansion <2>  }
  169.         CASE INTEGER OF
  170.         0: (
  171.             stateTable:            GlyphExpansionStateTable;
  172.             );
  173.         1: (
  174.             lookup:                WSILookupTableHeader;                    {  expanded glyph clusters follow here...  }
  175.             );
  176.     END;
  177.  
  178. {  Glyph-to-Character constants and types   }
  179.  
  180. CONST
  181.     kCurrentGlyphToCharVersion    = $00010100;
  182.  
  183.  
  184. TYPE
  185.     GlyphToCharLookupFormats            = INTEGER;
  186.  
  187. CONST
  188.     kGlyphToCharLookup8Format    = 1;
  189.     kGlyphToCharLookup16Format    = 2;
  190.     kGlyphToCharLookup32Format    = 3;
  191.  
  192.  
  193. TYPE
  194.     GlyphToCharFontIndex                = UInt8;
  195.     QDGlyphcode                            = UInt8;
  196.     GlyphToCharActionTablePtr = ^GlyphToCharActionTable;
  197.     GlyphToCharActionTable = RECORD
  198.         fontNameOffset:            WSISubtableOffset;                        {  offset relative to this table  }
  199.         actions:                WSILookupTableHeader;                    {  only support lookupSimpleArray format for now  }
  200.     END;
  201.  
  202.     GlyphToCharActionHeaderPtr = ^GlyphToCharActionHeader;
  203.     GlyphToCharActionHeader = RECORD
  204.         numTables:                INTEGER;                                {  0..n  }
  205.         offsets:                ARRAY [0..0] OF WSISubtableOffset;        {  offsets from start of action table header  }
  206.     END;
  207.  
  208.     GlyphToCharHeaderPtr = ^GlyphToCharHeader;
  209.     GlyphToCharHeader = RECORD
  210.         version:                Fixed;
  211.         actionOffset:            WSISubtableOffset;                        {  offset to GlyphToCharActionHeader  }
  212.         format:                    INTEGER;                                {  size of font mask  }
  213.         mappingTable:            WSILookupTableHeader;
  214.     END;
  215.  
  216. {
  217.  JUSTIFICATION TYPES
  218.     WorldScript supports justification of text using insertion. The justification
  219.     table specifies a insertion string to insert between 2 specified glyphs.
  220.     Each combination of inter-glyph boundary can be assigned a justification priority,
  221.     the higher the priority the more justification strings inserted at that position.
  222.     
  223.     The priorities for each inter-glyph boundary are specified by the justification table's
  224.     state table.
  225.     
  226.     Special handling is done for scripts which use spaces to justify, because the width of 
  227.     a space varies depending on the setting of SpaceExtra. This is why the number of spaces
  228.     per inserting string is specified in the justification table.
  229.  
  230. }
  231.  
  232. CONST
  233.                                                                 {  1.0 not supported  }
  234.     kCurrentJustificationVersion = $0200;
  235.  
  236.     kJustificationStateTableFormat = 1;
  237.  
  238.                                                                 {  WSI's internal limitation <12>  }
  239.     kMaxJustificationStringLength = 13;
  240.  
  241.  
  242. TYPE
  243.     WSIJustificationPriority            = UInt8;
  244.  
  245. CONST
  246.     WSIJustificationSetMarkMask    = $80;
  247.  
  248.  
  249. TYPE
  250.     WSIJustificationStateEntryPtr = ^WSIJustificationStateEntry;
  251.     WSIJustificationStateEntry = PACKED RECORD
  252.         markPriority:            WSIJustificationPriority;                {  non-zero priorities means insertion  }
  253.         priority:                WSIJustificationPriority;
  254.         newState:                WSIStateOffset;
  255.     END;
  256.  
  257.     WSIJustificationClasses                = INTEGER;
  258.  
  259. CONST
  260.     wsiJustEndOfLineClass        = 0;
  261.     wsiJustEndOfRunClass        = 1;
  262.     wsiJustDeletedGlyphClass    = 2;
  263.     wsiJustUserDefinedClass        = 3;
  264.  
  265.  
  266. TYPE
  267.     WSIJustificationStates                = INTEGER;
  268.  
  269. CONST
  270.     wsiStartOfLineState            = 0;                            {  pre-defined states  }
  271.     wsiStartOfRunState            = 1;
  272.     wsiUserDefinedState            = 2;
  273.  
  274. {  pre-multiplied: class# * sizeof(WSIJustificationStateEntry)  }
  275.  
  276. TYPE
  277.     WSIJustificationClassOffset            = UInt8;
  278.     WSIJustificationStateTablePtr = ^WSIJustificationStateTable;
  279.     WSIJustificationStateTable = RECORD
  280.         maxPriorities:            INTEGER;
  281.         rowWidth:                INTEGER;                                {  width of a state table row in bytes  }
  282.         classTableOffset:        INTEGER;
  283.         stateTableOffset:        INTEGER;
  284.     END;
  285.  
  286. {
  287.             Last two fields of above structure - someday?
  288.             WSIJustificationClassOffset    classes[up to 64 classes supported];
  289.             WSIJustificationStateEntry    states[up to your heart's desire];
  290. }
  291.     WSIJustificationHeaderPtr = ^WSIJustificationHeader;
  292.     WSIJustificationHeader = RECORD
  293.         version:                INTEGER;
  294.         format:                    INTEGER;
  295.         scaling:                Point;                                    {  numer/denom scaling of priority weights <7>  }
  296.         spacesPerInsertion:        INTEGER;                                {  # of $20 chars in justification insertion string <12>  }
  297.         justStringOffset:        INTEGER;                                {  offset to justification string  }
  298.         stateTable:                WSIJustificationStateTable;                {  long-aligned boundary aligned w/ spacesPerInsertion field - justification string follows  }
  299.     END;
  300.  
  301. {  Line Layout's Property table version <11>  }
  302.  
  303. CONST
  304.                                                                 {  v1.0  }
  305.     currentPropsTableVersion    = $00010000;
  306.  
  307.                                                                 {  ??? is this right  }
  308.     kCharToGlyphCurrentVersion    = 100;
  309.  
  310. {  pass as priorityWeight to JustifyWSILayout to use script's current just setting  }
  311.     kScriptsDefaultJustWeight    = -1;
  312.  
  313. {$ALIGN RESET}
  314. {$POP}
  315.  
  316. {$SETC UsingIncludes := WorldScriptIncludes}
  317.  
  318. {$ENDC} {__WORLDSCRIPT__}
  319.  
  320. {$IFC NOT UsingIncludes}
  321.  END.
  322. {$ENDC}
  323.